from ultralytics import YOLO
import cv2
def test1():
    # print("xxx")
    img = cv2.imread("/home/xieweig/PycharmProjects/books/photos/王五1.jpg")
    # print(img)
    cv2.imshow("any",img)
    cv2.waitKey(delay=5500)
    model = YOLO("../yolo11n.pt")
    # model.predict(img)
    results = model(img)
    img2 = results[0].plot()
    cv2.imshow("any",img2)
    cv2.waitKey(delay=4000)

    cv2.destroyAllWindows()
def test2():
    yolo = YOLO()
    results = yolo.predict("/home/xieweig/PycharmProjects/books/photos/王五1.jpg")
    results[0].show()

if __name__ == '__main__':
    test1()